import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
	state: {
		userInfo:{},
		accessToken: '',
		launchFlag:true,
		versionData:{},
		orderSocket:null
	},
	mutations: {
		login(state, provider) {
			state.userInfo = provider;
			state.accessToken = provider.token;
			uni.setStorageSync('accessToken', provider.token);
			uni.setStorageSync('userInfo', provider);
		},
		logout(state) {
			state.userInfo = {};
			state.accessToken = '';
			uni.removeStorageSync('accessToken');
			uni.removeStorageSync('userInfo');
		},
		isLaunchFlag(state,provider){
			state.launchFlag=provider
			uni.setStorageSync('launchFlag', provider);
		},
		setVersionData(state,provider){
			state.versionData=provider
			uni.setStorageSync('versionData', provider);
		},
	},
	getters: {
		
	},
	actions: {

	}
})

export default store
